<template>
  <div class="waitao">
    <div class="box">
      <h1>添加销售人员</h1>
      <el-form
        :model="user"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item
          label="账号"
          prop="username"
        >
          <el-input v-model="user.userName"></el-input>
        </el-form-item>

        <el-form-item
          label="密码"
          prop="password"
        >
          <el-input v-model="user.password"></el-input>
        </el-form-item>

        <el-form-item
          label="电话号码"
          prop="phone"
        >
          <el-input v-model="user.phone"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button
            type="primary"
            @click="addOneSalesman"
          >新增</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import api from "../../../network/apis/api";
export default {
  data() {
    return {
      user: {
        userName: "",
        password: "",
        phone: "",
      },
    };
  },
  methods: {
    async addOneSalesman() {
      const data = await api.salesmans.addOneSalesman(this.user);
      console.log(this.user);
      if (data.status) {
        this.$router.push("/admin/salesmansList");
      }
    },
  },
};
</script>

<style>
.box {
  width: 400px;
  height: 300px;
  margin: 100px auto;
}
.waitao {
  width: 600px;
  height: 300px;
  /* background: url('./img/abe1eea3ca79fc28-c577ebdcb0f3dbcc-aea9558e3eacd634f250d740f671de22.jpg'); */
  text-align: center;
  margin: 0px auto;
}
body {
  /* background: url('./img/timg.jpg') no-repeat ; */
  background-size: cover;
}
</style>
